﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Linq;
using System.Linq.Expressions;
using System.Reflection;

namespace NET4.Database.Repository
{
  public class Repository<T, F> where T : class
                                where F : new()
  {
    private DataContext dataContext;
    protected DataContext DataContext
    {
      get { return this.dataContext; }
      set { this.dataContext = value; }
    }

    protected Table<T> Table
    {
      get { return this.DataContext.GetTable<T>(); }
    }

    private static F instance;
    public static F Instance
    {
      get
      {
        if (instance == null) { instance = new F(); }
        return instance;
      }
    }

    public Repository(DataContext dataContext)
    {
      this.dataContext = dataContext;
    }
  }
}
